package com.dolphin.servicemap.controller;

import com.dolphin.common.dto.ResponseResult;
import com.dolphin.common.dto.TrsearchResponse;
import com.dolphin.common.response.TerminalResponse;
import com.dolphin.servicemap.remot.TerminalClient;
import com.dolphin.servicemap.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/terminal")
public class TerminalController {
    @Autowired
    private TerminalService  terminalService;

    @PostMapping("/add")
    public ResponseResult add(@RequestParam String name,@RequestParam String desc) {
        return terminalService.add(name,desc);
    }

    @PostMapping("/aroundsearch")
    public ResponseResult<List<TerminalResponse>> aroundSearch(String center, Integer radius) {
        return terminalService.aroundSearch(center,radius);
    }

    @PostMapping("/trsearch")
    public ResponseResult<TrsearchResponse> trsearch(String tid, Long starttime, Long endtime) {

        return terminalService.trsearch(tid,starttime,endtime);

    }
}
